﻿@model IEnumerable<OAWeb.Models.StudentScore>

@{
    ViewBag.Title = "ScoreSubject";
}

<h2>科目成绩</h2>
@{

}

<table class="table">
    <tr>
        <td>学号</td>
        <td>姓名</td>
        <td>@Model.ToArray()[0].CourseName</td>
        <td>班级排名</td>
        <td>年级排名</td>
    </tr>
    @{

        int i = 0;
        string[,] s = new string[Model.ToArray().Length, 4];

        double[] s1 = new double[Model.ToArray().Length];
        for (int j = 0; j < Model.ToArray().Length; j++)
        {
            s[j, 0] = Model.ToArray()[j].Number;
            s[j, 1] = Model.ToArray()[j].Name;
            s[j, 2] = ViewBag.scoreitems[j].ToString();
            s[j, 3] = Model.ToArray()[j].StdNumber.ToString();
        }

        for (int k = 0; k < Model.ToArray().Length - 1; k++)
        {
            for (int l = 0; l < Model.ToArray().Length - k - 1; l++)
            {
                if (int.Parse(s[l, 2]) < int.Parse(s[l + 1, 2]))
                {
                    for (int b = 0; b < 4; b++)
                    {
                        string[,] s2 = new string[Model.ToArray().Length, 4];
                        s2[l, b] = s[l, b];
                        s[l, b] = s[l + 1, b];
                        s[l + 1, b] = s2[l, b];
                    }
                }
            }
        }

        for (int a = 0; a < Model.ToArray().Length; a++)
        {
            int count = 0;
            <tr>
                <td>@s[a, 0]</td>
                <td>@s[a, 1]</td>
                <td>@s[a, 2]</td>
                <td>@(a + 1)</td>

                <td>
                    @foreach (KeyValuePair<string, double> d in ViewBag.dict)
                    {
                        count++;

                        if (s[a, 3] == d.Key)
                        {

                            @count
                        }

                    }


                </td>
            </tr>
            i++;
        }
    }
</table>
